home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS18.ADF
/
Progs
/
StarProbe
/
ReadMe.DOC
< prev
next >
Wrap
Text File
|
1989-01-27
|
12KB
|
283 lines
/*****************************************************************************
* *
* S T A R P R O B E *
* *
* Copyright (c) 1987 by Michael F. Purcell *
* *
* *
* The author grants permission for the non-commercial distribution of this *
* software, provided that this and other identifying information remains *
* intact. *
* *
* . . . . . . . . . . . . . . . . . . *
* *
* This software is provided "as-is" and carries with it no explicit or *
* implicit promise of support by the author. Nor will the author be held *
* liable for any damages, real or imagined, which may result from the use *
* or abuse of this software. *
* *
* . . . . . . . . . . . . . . . . . . *
* *
* *
* This program calculates a mathematical model of a star's interior. *
* *
* The author may be contacted via: *
* *
* - Star Net: as 'Mike Purcell' (1-612-681-9520) *
* *
* - People/Link: as 'ASTRO*NUT' *
* *
* - CompuServe: as '73647,1102' *
* *
*****************************************************************************/
Documentation Outline
I. A Request from the Author
II. Program Background
III. Arc file descriptions
IV. Bibliography
V. Program Limitations
VI. Amiga vs. IBM-PC compile, link, & execute
VII. Input Parameter File
VIII. Program Structure & Flow
IX. Program Output: the Report
X. Program Output: the Data file
XI. Graphical Display in AmigaBasic
XII. Acknowledgements
I. A request from the Author
I would appreciate feedback from users of this program. Please
inform me of errors found, modifications made, or resources I can use
to improve the algorithm. I would be especially grateful for
references to or examples of simple dynamic models.
II. Background
This program grew out of my attempts (as an amateur astronomer) to
better understand stellar structure & evolution. As such it is a
highly simplified model when compared with professional models running
on scientific supercomputers. It really does nothing more than
recreate the kind of computations done BY HAND in the '40s & '50s
by people such as Chandrasekhar, Schwarzschild, and others.
It is certainly not complete (see the section on Limitations),
but it does produce a reasonable model for our sun. The algorithm
used is called the 'integration method'. Its main drawback is that
it is not good for stars undergoing rapid change (post-main sequence).
This is not yet a problem because the program only performs a static
analysis.
I attempted to keep the program structure as clean and modular as
possible. This was to facilitate changes. No real code optimization
has been attempted. A single complete integration takes approximately
1 minute on the Amiga, and somewhat longer on the IBM-PC. The program
speed is dependent on the C compiler double-precision floating-point
software, and on the number of mass points being evaluated.
III. Arc file descriptions
File Description
---- -----------
astro.h Astronomical constants
filter.c A simple source filter for IBM-AMIGA movement cleanup
input.c General input functions
msdos.chg Source changes when moved from the Amiga to the IBM-PC
sp A 'make' file for IBM
spdata1 A sample output data file to be used by spdraw.bas
spint.h Global integer data
spflt.h Global double precision floating point data
spmac.h Global macros
spref.h Invokes spint.h & spflt.h as 'extern'
spmain.c Program outer block, owns global data
spinit.c Initialization functions
speval.c Physics/calculus evaluations & driver
spfit.c Fitting point routines
sprpt.c Output functions for reports & data
spdraw.bas AmigaBasic program to plot the output data
link.amg Linker input for the Amiga
link.ibm Linker input for the IBM-PC
probe.amg Executable program for the Amiga
spparm.dbg Debugging input parameter file
spparm.in Default input parameter file
spparm.doc Parameter file documentation
IV. Bibliography
Most of the physics functions refer to one or more sources.
The sources are as follows:
Bowers & Deeming, "Astrophysics I: Stars", Jones & Bartlett, 1984
(an excellent intermediate-level reference).
Clayton, "Principles of Stellar Evolution and Nucleosynthesis",
McGraw-Hill, 1968.
Motz, "Astrophysics & Stellar Structure", Ginn, 1970.
Aller & McLaughlin (eds.), "Stellar Strucure", Univ. of Chicago Press,
1965.
V. Program Limitations
StarProbe performs a static analysis of the interior of an initial
main sequence star. A dynamic analysis (of changes over time) would
require the tracking of entropy and composition, a complication
that I am not yet ready to attempt. Using an 'initial' star permits
the assumption that the composition is the same throughout the star.
The model is very sensitive to the initial parameters (central temp,
central pressure, surface luminosity, surface radius). Currently,
if the mass parameter is set to 1.0 (the Sun) it uses known values.
This will result in a fairly accurate model. The parameters resulting
from other initial mass values are not yet very good.
Note that the differential equations which describe pressure,
temperature, luminosity, and radius are all functions of the current
mass fraction (at the center m=0, at the surface m=M). The mass
gradient defined in the parameter file directly affects the accuracy
and performance of the program.
One problem area, which I have not yet resolved, is the function that
calculates opacity. If the mass fraction at the fitting point is 0.5, then
the opacity values calculated between 0.3 and 0.5 of the mass are
incorrect. Setting the fitting point to 0.3 hides most of this
problem. It is possible that the reference I used for the opacity
function had a typo in the equations. Replacing the approximation
formulae with published opacity tables is probably the best solution.
VI. Amiga vs. IBM-PC compile, link, & execute
I have made every effort to keep this program fully compatible with
the IBM-PC. It was developed on an Amiga using Lattice C version 3.10.
It has been successfully downloaded to an IBM-PC, un-Arc'd, compiled,
linked, and executed. The file names have been kept compatible with
MS-DOS, and no AmigaDos library facilities are used.
Actually, this will run anywhere a "standard" C compiler is available.
The filter program is included to assist in cleaning up the source
for other (MacIntosh, Atari, UNIX, ...) environments.
The program was broken into functional pieces for ease of development.
There is no reason why they can't be combined if that suits the user.
Contrary to the first paragraph, the program to display the data is
written in AmigaBasic. Nevertheless, because this Basic was developed by
MicroSoft, IBM-PC users should not have serious difficulty converting
it.
To execute the program, simply 'run' it without parameters. Everything
it needs is in "spparm.in".
VII. Input Parameter File
The parameter file (described fully in spparm.doc) provides the
following information to the program:
- Mass of the star
- Debug options
- Maximum integrations (when to give up)
- Composition
- Mass fraction at the fitting point
- The mass gradient values over which to integrate (total=1.0).
VIII. Program Structure & Flow
The overall flow is fairly simple. The outer block (main) calls
Initialize to read the parameter file and set up the integration.
The Evaluator is called to perform the integration(s) and Shutdown
cleans up.
After setting up the fitting point, the evaluation driver will:
1. Integrate from the surface to the fitting point
2. Integrate from the center to the fitting point
3. Write the results to a new output file
4. Evaluate the fitting point and determine new initial values
until the discrepancies at the fitting point are 'small' enough.
My experience so far is that the driver will reach the maximum
integration value before it likes the fitting point values. It
seems that the 2nd or 3rd integration usually produces the smoothest
data curves. After that, the values get worse, not better. I am not
sure if the fitting procedure has an error, or if 'small enough' is
too small.
All functions are assigned a number. This number is used when
turning on the trace facilities or when an error is detected.
The best way to follow the progress of the integration is to
turn on tracing for the evaluation driver and the main integrator.
Setting this up is described in 'spparm.doc'. Beware: even a limited
trace request will generate a large amount of output for each
integration.
The program uses an 'assertion' macro to detect unreasonable or
impossible values. When a bad value is detected, the bad value
and related parameters, along with the procedure number, are
displayed.
IX. Program Output: the Report
A summary of the results is writtem to 'sprpt.out' after each
integration. This report is rather crude, and not as informative
as the graphics program.
X. Program Output: the Data files
A series of files called 'spdata.x', where 'x' is the integration
count, is produced as the integrations proceed. These files are
used by the graphics program.
The first value in each file is the number of mass points. Each mass
point has the following values:
1. Current mass
2. Pressure
3. Temperature
4. Luminosity
5. Radius
6. Density
7. Opacity (-1 if in a convective region)
8. Energy generation rate
XI. Graphical Display in AmigaBasic
This allocates the arrays based on the number of mass points. As it
it loading the arrays, it keeps track of high/low values for each
attribute. These high/low values are used later to scale the display,
and are shown on the screen when the arrays are loaded.
There are two kinds of displays: pictures and graphs. A 'picture' is a
disk with color shadings used to represent the gradient from low to
high for the requested data value. A single large picture, or multiple
small pictures may be drawn. A 'graph' is a plot of the data value
against either mass or radius. Plotting by mass shows the fitting
point discrepancy, while plotting by radius gives a feel for the
physical structure. Any or all data values may be plotted on a single
graph.
Note: plots using the logarithm of the data values do not yet work.
XII. Acknowledgements
Thanks to Bill Evans for his help with the IBM compatability.
Some of the ideas for the display in spdraw.bas were borrowed from
DeluxDraw.bas by Rick Wirch.